<?php
require_once 'groupAccDTO.php';
require_once 'dbHelper.php';

class groupAccDAO extends dbHelper
{
    public function create($groupAccDTO)
	{
		$sql = "insert into groupAcc(name, role, joinDate, location, discription, accId)
                values('$groupAccDTO->name', 
                        '$groupAccDTO->role',
                        '$groupAccDTO->joinDate',
                        '$groupAccDTO->location',
                        '$groupAccDTO->discription', 
                        '$groupAccDTO->accId')";
		parent::execQuery($sql);
		if(parent::getAffectedRows() > 0)
			return true;
		return false;
	}
    
    public function update($groupAccDTO)
	{
		$sql = "update groupAcc set  name = '$groupAccDTO->name',
                                  location = '$groupAccDTO->location',
                                  discription = '$groupAccDTO->discription'";
		parent::execQuery($sql);
		if(parent::getAffectedRows() > 0)
			return true;
		return false;
	}
    
    public function delete($grpId)
	{
		$sql = "delete from groupAcc where grpId = '$grpId'";
		parent::execQuery($sql);
		if(parent::getAffectedRows() > 0)
			return true;
		return false;
	}
}
?>